#ifndef 		_TABLE_H_
#define 		_TABLE_H_

#include 		<stdio.h>

#define 		MAX_FILE_DIRECTORY 			128
#define 		MAX_FIELD_NAME_LEN 			64
#define 		MAX_TABLE_NAME_LEN 			64
#define 		MAX_FIELD_NUM 				128

#define 		BASE_DIRECTORY 			"/home/yankai/db/"
#define 		DATA_DIRECTORY 			"/home/yankai/db/table_datas/"

struct BLOCK_INFO
{
	char	szBlockMark[8];
	int		iBlockNum;
};

struct FIELD
{
	char 	szFieldName[MAX_FIELD_NAME_LEN];
	int 	iType;
	int 	iLength;
	int 	bIsKey;
	int 	bIsNull;
};

struct TABLE
{
	char 	szTableName[MAX_TABLE_NAME_LEN];
	int 	iFieldNum;
	struct FIELD sfaFields[MAX_FIELD_NUM];
};

int init_database();

int find_field(struct TABLE stTable, char *szFieldName, int *ipType);

int check_table_exist(char *szTableName);

int find_table(FILE *fp, char *szTableName);

int create_table(struct TABLE stNewTable);

int drop_table(char *szTableName);

int show_tables();

int desc_table(char *szTableName);

#endif
